<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="telephone=no,email=no" name="format-detection">
    <meta name="theme-color" content="#f04848">

    <meta name="applicable-device" content="mobile">
    <meta http-equiv="Cache-Control" content="no-transform" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">

    <link href="/static/zdm/commons.css" rel="stylesheet">
    <link href="/static/zdm/faxian.css" rel="stylesheet">
    <title>{% if category %}{{ category_name }}{% else %}实时优惠{% endif %}</title>
    <meta name="description" content="网友分享的好品牌、好质量、好价格商品，所有优惠打折分享全部来自于经过甄选的网友爆料，发现频道最大的特点是优惠商品更新快、品类广，给您带来比比价网更有趣的网购体验。" />
    <meta name="keywords" content="发现频道,网友爆料,打折商品,比价网" />
    
    <!-- canonical_url -->
    <link rel="canonical" href="https://www.ztm.me/youhui/"/>
    <!-- canonical_url END -->
    <script>
        function getRem() {
            var $html = document.querySelector('html');
            var oWidth = $html.clientWidth || document.documentElement.clientWidth;
            if (oWidth > 750) {
                $html.style.fontSize = 750 / 10 + 'px';
            } else {
                $html.style.fontSize = oWidth * .1 + 'px';
            }
        }
        getRem();
        window.onresize = function() {
            getRem();
        }
    </script>

    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-113208908-1"></script>
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'UA-113208908-1');
    </script>
</head>
<body>
    <!--
    <div class="top-applink">
        <div class="swiper-wrapper" id="J_banner_box">
            <div class="swiper-slide">
                <div class="btn-banner-close J_toplink_close">
                    <i class="icon-close"></i>
                </div>
                <div class="app-info">
                    <span class="app-logo"><img src="/static/zdm/logo_app.png" alt="app"></span>
                    <div class="app-intro">更多超值优惠，尽在值得买好价频道<br>快去下载App查看吧</div>
                </div>
                <div class="btn-app-open">
                    <a class="J_ota" href="#" data-article="" data-channel="" target="_blank">打开</a>
                </div>
            </div>
        </div>
    </div>
    -->
    <header class="head_banner header-top fixed" id="J_header_top">
    <div class="header-in">
        <!-- 顶部白色logo -->
        <div class="header-white">
            <div class="logo-img">
                <h1 id="logo">
                    <a href="https://m.ztm.me/"><img src="/static/zdm/logo.png"></a>
                </h1>
            </div>
            <div class="logo-search">
                <i class="icon-search zm-icon-search-o"></i>
                <input type="text" name="search" placeholder="搜索分类/品牌/商品" id="J_enter_search">
                <img src="/static/zdm/delete.png" class="icon-cancel" id="J_icon_cancel">
            </div>
            <!--
            <div class="logo-download">
                <a target="_blank" class="J_ota" href="#" onclick="dataLayer.push({'event':'WAP站banner下载浮层','tag':'faxian_list','name':'列表页'})">下载</a>
            </div>
            -->
        </div>
        <div class="header-tab">
            <div class="header-inner">
                <div class="channel-list">
                    <ul >
                        {% if not category %}
                            <li><a href="/youhui/" class="cur-tab">全部好价</a></li>
                        {% else %}
                            <li><a href="/youhui/">全部好价</a></li>
                        {% endif %}
                        {% if category == 'mu-ying-yong-pin' %}
                            <li><a href="/youhui/category/mu-ying-yong-pin/" class="cur-tab">母婴用品</a></li>
                        {% else %}
                            <li><a href="/youhui/category/mu-ying-yong-pin/">母婴用品</a></li>
                        {% endif %}
                        {% if category == 'dian-nao-shu-ma' %}
                            <li><a href="/youhui/category/dian-nao-shu-ma/" class="cur-tab">电脑数码</a></li>
                        {% else %}
                            <li><a href="/youhui/category/dian-nao-shu-ma/">电脑数码</a></li>
                        {% endif %}
                        {% if category == 'shi-pin-bao-jian' %}
                            <li><a href="/youhui/category/shi-pin-bao-jian/" class="cur-tab">食品保健</a></li>
                        {% else %}
                            <li><a href="/youhui/category/shi-pin-bao-jian/">食品保健</a></li>
                        {% endif %}
                        {% if category == 'ge-hu-hua-zhuang' %}
                            <li><a href="/youhui/category/ge-hu-hua-zhuang/" class="cur-tab">个护化妆</a></li>
                        {% else %}
                            <li><a href="/youhui/category/ge-hu-hua-zhuang/">个护化妆</a></li>
                        {% endif %}
                        {% if category == 'ban-gong-she-bei' %}
                            <li><a href="/youhui/category/ban-gong-she-bei/" class="cur-tab">办公设备</a></li>
                        {% else %}
                            <li><a href="/youhui/category/ban-gong-she-bei/">办公设备</a></li>
                        {% endif %}
                        {% if category == 'ri-yong-bai-huo' %}
                            <li><a href="/youhui/category/ri-yong-bai-huo/" class="cur-tab">日用百货</a></li>
                        {% else %}
                            <li><a href="/youhui/category/ri-yong-bai-huo/">日用百货</a></li>
                        {% endif %}
                        {% if category == 'tu-shu-yin-xiang' %}
                            <li><a href="/youhui/category/tu-shu-yin-xiang/" class="cur-tab">图书音像</a></li>
                        {% else %}
                            <li><a href="/youhui/category/tu-shu-yin-xiang/">图书音像</a></li>
                        {% endif %}
                        {% if category == 'jia-yong-dian-qi' %}
                            <li><a href="/youhui/category/jia-yong-dian-qi/" class="cur-tab">家用电器</a></li>
                        {% else %}
                            <li><a href="/youhui/category/jia-yong-dian-qi/">家用电器</a></li>
                        {% endif %}
                        {% if category == 'lv-you-chu-xing' %}
                            <li><a href="/youhui/category/lv-you-chu-xing/" class="cur-tab">旅游出行</a></li>
                        {% else %}
                            <li><a href="/youhui/category/lv-you-chu-xing/">旅游出行</a></li>
                        {% endif %}
                        {% if category == 'jia-ju-jia-zhuang' %}
                            <li><a href="/youhui/category/jia-ju-jia-zhuang/" class="cur-tab">家居家装</a></li>
                        {% else %}
                            <li><a href="/youhui/category/jia-ju-jia-zhuang/">家居家装</a></li>
                        {% endif %}
                        {% if category == 'fu-shi-xie-bao' %}
                            <li><a href="/youhui/category/fu-shi-xie-bao/" class="cur-tab">服饰鞋包</a></li>
                        {% else %}
                            <li><a href="/youhui/category/fu-shi-xie-bao/">服饰鞋包</a></li>
                        {% endif %}
                        {% if category == 'yun-dong-hu-wai' %}
                            <li><a href="/youhui/category/yun-dong-hu-wai/" class="cur-tab">运动户外</a></li>
                        {% else %}
                            <li><a href="/youhui/category/yun-dong-hu-wai/">运动户外</a></li>
                        {% endif %}
                        {% if category == 'wan-mo-le-qi' %}
                            <li><a href="/youhui/category/wan-mo-le-qi/" class="cur-tab">玩模乐器</a></li>
                        {% else %}
                            <li><a href="/youhui/category/wan-mo-le-qi/">玩模乐器</a></li>
                        {% endif %}
                        {% if category == 'qi-che-xiao-fei' %}
                            <li><a href="/youhui/category/qi-che-xiao-fei/" class="cur-tab">汽车消费</a></li>
                        {% else %}
                            <li><a href="/youhui/category/qi-che-xiao-fei/">汽车消费</a></li>
                        {% endif %}
                    </ul>
                </div>
            </div>
        </div>
    </div>
</header>
<div id="ch-mirrors"></div>

<input type="hidden" id="search_top_category" value="">
<input type="hidden" id="page" value="{{page}}">
<input type="hidden" id="category" value="{{category}}">
<input type="hidden" id="url" value="/youhui/{% if category %}category/{{category}}/{% endif %}">
<div class="wrap-content">
    <ul id="J_scroll_ul" class="card-group z-clearfix">
    {% if current_page_items %}
    {% for item in current_page_items %}
        <li class="card-group-list" timesort="{{ item.timesort }}" onclick="dataLayer.push({'event':'WAP发现首页_标题','文章标题':'{{ item.article_title }}'});">
            <a href="/youhui/detail/{{ item.id }}/">
                <div class="zm-card">
                    <div class="zm-card-media">
                        <img src="/static/img/loading.gif" data-src="{% if item.qiniu_pic %}{{ item.qiniu_pic }}{% else %}//img.ztm.me/img/noimg.png{% endif %}" alt="{{item.article_title|safe}}" alt="{{ item.article_title }}" />
                        <!--<div class="card-label card-label-kuajing">跨境精选</div>-->
                        <!--<div class="card-time"></div>-->
                    </div>
                    <div class="zm-card-content">
                        <div class="zm-card-title">{{ item.article_title }}</div>
                        <div class="zm-card-price">{{ item.article_price }}</div>
                        <div class="zm-card-info">
                            <span class="info-mall">{{ item.article_mall }} </span>
                            <span class="info-comments">{{item.article_date}}</span>
                        </div>
                    </div>
                </div>
            </a>
        </li>
    {% endfor %}
    {% endif %}
    </ul>
    <div class="loading" id="J_loading"><img src="/static/img/loading3.gif"></div>
    <div class="pagination">
        <div class="prev"><a href="/youhui/{% if category %}category/{{category}}/{% endif %}?page={{ page|add:'-1'}}"><i class="zm-icon-arrow-left"></i></a></div><span>上一页</span>
        <div class="next"><a href="/youhui/{% if category %}category/{{category}}/{% endif %}?page={{ page|add:'+1'}}"><i class="zm-icon-arrow-right"></i></a></div><span>下一页</span></div>
    <div class="loaded-end" id="J_loaded_end">没有了哦</div>

</div>
<script id="tpl" type="text/html">
    <li class="card-group-list">
        <a href="<%=article_url%>">
            <div class="zm-card">
                <div class="zm-card-media">
                    <img src="/static/img/loading.gif" data-src="<%=article_pic%>" alt="<%=article_title%>"/>
                    <div class="card-time"></div>
                </div>
                <div class="zm-card-content">
                    <div class="zm-card-title"><%=article_title%></div>
                    <div class="zm-card-price"><%=article_price%></div>
                    <div class="zm-card-info">
                        <span class="info-mall"><%=article_mall%></span>
                        <span class="info-comments"><%=article_date%></span>
                    </div>
                </div>
            </div>
        </a>
    </li>
</script>
<!--foot-banner-->

<div class="foot-banner">
    <input type="hidden" id="J_from_share" value="0">
    <input type="hidden" id="J_ga_tag" value="faxian_list">
    <input type="hidden" id="J_ga_name" value="列表页">
    <input type="hidden" id="J_share_link" value="">
    <!--
    <input type="hidden" id="J_share_pic" value="http://y.zdmimg.com/201811/14/5bec1a3d325689016.png">
    -->
    <div class="mode">
        <div class="mode-touch">当前为触屏版</div>
        <div class="mode-pc"><a href="//m.ztm.me/switch_edition">切换到电脑版<em><img src="/static/zdm/download_arrow.png"></em></a></div>
    </div>
    <!--foot-banner end-->
    <div class="right-return-top">
        <div class="return-top">
            <img src="/static/zdm/return_top.png">
        </div>
    </div>
</div>
<!-- 搜索浮层模板 -->
<div class="search-cover" id="J_search_cover">
    <!-- 搜索页头部搜索框 -->
    <form action="/youhui/" method="get" class="search-header" id="J_search_form">
        <i class="search-return zm-icon-arrow-left" id="J_search_close"></i>
        <div class="search-input" id="J_search_sug">
            <i class="icon-search zm-icon-search-o"></i>
            <input type="text" name="s" placeholder="搜索商品" id="J_search_input" >
            <img src="/static/zdm/delete.png" class="icon-cancel" id="J_search_clear">
        </div>
        <button type="submit" class="search-button" disabled="disabled" id="J_search_btn">搜索</button>
    </form>
    <div class="search-hot">
        <div class="hot-title">热门搜索</div>
        <ul class="hot-list">
            <li><a href="/youhui/?s=京东Plus&source=hot_keyword">京东Plus</a></li>
            <li><a href="/youhui/?s=历史低价&source=hot_keyword">历史低价</a></li>
            <li><a href="/youhui/?s=白菜价&source=hot_keyword">白菜</a></li>
            <li><a href="/youhui/?s=超值&source=hot_keyword">超值</a></li>
            <li><a href="/youhui/?s=双重优惠&source=hot_keyword">双重优惠</a></li>
            <li><a href="/youhui/?s=神价格&source=hot_keyword">神价格</a></li>
            <li><a href="/youhui/?s=绝对值&source=hot_keyword">绝对值</a></li>
            <li><a href="/youhui/?s=近期好价&source=hot_keyword">近期好价</a></li>
        </ul>
    </div>
</div>

<script type="text/javascript" src="/static/zdm/commons.js"></script>
<script type="text/javascript" src="/static/zdm/faxian.js"></script>
<script src="//libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="//img.ztm.me/js/underscore/underscore-min.js"></script>
<script type="text/javascript" src="/static/js/template.js"></script>
<script>

  function ajax_load_more() {
      $.ajax({
          type:"GET",
          url:'/youhui/{% if category %}category/{{category}}/{% endif %}',
          data: {
            page: parseInt($("#page").val()) + 1,
            isAjax: true,
            r: Math.random()
          },
          dataType:'json',
          beforeSend:function(){
            $("#J_loading").show() //显示加载时候的提示
          },
          success:function(data){
            $("#page").val(data.page);
            items = data.result;
            $(items).each(function () {
                var mapping = {
                    article_url:   '/youhui/detail/'+this.id+'/',
                    article_pic:   this.qiniu_pic,
                    article_title: this.article_title,
                    article_price: this.article_price,
                    article_mall:  this.article_mall,
                    article_date:  this.article_date
                };
                var tpl = document.getElementById('tpl').innerHTML;
                var html = template(tpl, mapping);
                $("#J_scroll_ul").append(html);
            });
            $("#J_loading").hide();
            // 获取window的引用:
            var $window = $(window);
            // 获取包含data-src属性的img，并以jQuery对象存入数组:
            var lazyImgs = _.map($('img[data-src]').get(), function (i) {
                return $(i);
            });
            // 定义事件函数:
            var onScroll = function() {
                // 获取页面滚动的高度:
                var wtop = $window.scrollTop();
                // 判断是否还有未加载的img:
                if (lazyImgs.length > 0) {
                    // 获取可视区域高度:
                    var wheight = $window.height();
                    // 存放待删除的索引:
                    var loadedIndex = [];
                    // 循环处理数组的每个img元素:
                    _.each(lazyImgs, function ($i, index) {
                        // 判断是否在可视范围内:
                        if ($i.offset().top - wtop < wheight) {
                            // 设置src属性:
                            $i.attr('src', $i.attr('data-src'));
                            // 添加到待删除数组:
                            loadedIndex.unshift(index);
                        }
                    });
                    // 删除已处理的对象:
                    _.each(loadedIndex, function (index) {
                        lazyImgs.splice(index, 1);
                    });
                }
            };
            // 绑定事件:
            $window.scroll(onScroll);
            // 手动触发一次:
            onScroll();
          }
      })
  }

$(window).scroll(function(){
    var scrollTop = $(this).scrollTop();
    var scrollHeight = $(document).height();
    var windowHeight = $(this).height();
    if(scrollTop + windowHeight == scrollHeight){
        $("#J_loading").show();
        ajax_load_more();
    }
});
// 注意: 需要引入jQuery和underscore
$(function() {
    // 获取window的引用:
    var $window = $(window);
    // 获取包含data-src属性的img，并以jQuery对象存入数组:
    var lazyImgs = _.map($('img[data-src]').get(), function (i) {
        return $(i);
    });
    // 定义事件函数:
    var onScroll = function() {
        // 获取页面滚动的高度:
        var wtop = $window.scrollTop();
        // 判断是否还有未加载的img:
        if (lazyImgs.length > 0) {
            // 获取可视区域高度:
            var wheight = $window.height();
            // 存放待删除的索引:
            var loadedIndex = [];
            // 循环处理数组的每个img元素:
            _.each(lazyImgs, function ($i, index) {
                // 判断是否在可视范围内:
                if ($i.offset().top - wtop < wheight) {
                    // 设置src属性:
                    $i.attr('src', $i.attr('data-src'));
                    // 添加到待删除数组:
                    loadedIndex.unshift(index);
                }
            });
            // 删除已处理的对象:
            _.each(loadedIndex, function (index) {
                lazyImgs.splice(index, 1);
            });
        }
    };
    // 绑定事件:
    $window.scroll(onScroll);
    // 手动触发1次:
    onScroll();
  })
</script>

<script>
    function gtm(){
        console.log('gtmabtest', abtest)
        dataLayer.push({
            'event': 'addToCart',
            'ecommerce': {
                'currencyCode': 'CNY',
                'add': {
                    'products': [{
                        'name': '',
                        'id': '',
                        'price': '0',
                        'brand': '',
                        'category': '',
                        'dimension12': '',
                        'metric1': '0',
                        'dimension10': '',
                        'dimension9': '',
                        'dimension11': '',
                        'dimension36': '',
                        'dimension38': '',
                        'quantity': 1,
                        'dimension75': typeof abtest !== 'undefined' ? abtest : ''
                    }]
                }
            }});
    }
</script>
</body>
</html>